home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / replace.doc < prev    next >
Text File  |  1995-03-31  |  2KB  |  42 lines

  1. REPLACE.DOC, an HPCVBBS posting by Joe Horn 
  2. All about the System RPL word 'REPLACE' 
  3.  
  4. akcs.levenson@hpcvbbs.cv.hp.com (William J. Levenson) writes: 
  5.  
  6. > There seems to be many RPL words defined in entries.a that are not 
  7. > mentioned in rplman.doc.  I am specifically interested in REPLACE. 
  8. > Is this similar to the User RPL REPL and what arguments are returned 
  9. > and what arguments are expected? 
  10.  
  11. REPLACE is a version of STO that does not use the var's name. 
  12.  
  13. INPUT: 
  14.  
  15. 2: New object to be stored. 
  16. 1: Old *contents* of variable (NOT NEWOB'd!!!) 
  17.  
  18. Then REPLACE will stuff the new object into the memory location of the 
  19. old object, and drop the old object from the stack, leaving just the 
  20. new object (at its new address) on the stack. 
  21.  
  22. EXAMPLE: "OLD"  'ABC'  STO  --> this stores "OLD" into ABC 
  23.          "NEW"   ABC        --> 2:NEW, 1:OLD (inside ABC) 
  24.          #85D3h SYSEVAL     --> 1:NEW (also inside ABC now) 
  25.          ABC                --> see? 
  26.  
  27. Thus, instead of FOO 'BAR' STO, use FOO BAR REPLACE. 
  28.  
  29. IMPORTANT: Since REPLACE assumes that the object on level 1 is inside 
  30. a variable, be sure that it really is.  If a NEWOB is performed on it, 
  31. or if it is otherwise located in temporary memory (or anywhere other 
  32. than inside a named var), REPLACE will corrupt memory and almost 
  33. certainly cause a Memory Clear. 
  34.  
  35. The danger is worth it, however.  I just timed 153 'ABC' STO, and it 
  36. took 23.5 milliseconds; % 858 ID ABC REPLACE took 2 milliseconds! 
  37. (Times can vary widely). 
  38.  
  39. NOTE: All previously posted lists of SYSEVAL addresses that contained 
  40. 085D3 had the stack order backwards.  If you keep such a list (e.g. 
  41. for Voyager's use), be sure to update it. 
  42.